package com.cman777.springc.idempotence.config;

import com.cman777.springc.idempotence.IdempotenceClient;
import com.cman777.springc.idempotence.IdempotenceAspect;
import com.cman777.springc.redis.config.RedisConfig;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author chenzhicong
 * @time 2020/9/15 11:31
 */
@Configuration
@AutoConfigureAfter(RedisConfig.class)
public class IdempotenceConfig {


    @Bean
    @ConditionalOnBean(IdempotenceClient.class)
    @SuppressWarnings("all")
    public IdempotenceAspect idempotenceAspect(IdempotenceClient idempotenceClient){
        return new IdempotenceAspect(idempotenceClient);
    }





}
